//#include "MSS_ReplayController.h"
//
//Sx::Simulation::Interface::MSS_ReplayController::MSS_ReplayController(Viewport* viewport, Graphics::Objects::Rendering::RendererImplementation* cameraRenderer, Simulations::MassSpringSimulation* simulation) : MassSpringSimulationController(viewport, cameraRenderer, simulation) {
//	this->paused = true;
//	this->recording = nullptr;
//}
//
//Sx::Simulation::Interface::MSS_ReplayController::~MSS_ReplayController() {
//	/* this->recording is not owned by this class */
//}
//
//void Sx::Simulation::Interface::MSS_ReplayController::render() const {
//	if ( this->simulation == nullptr ) return;
//
//	bool frameLoaded = this->loadFrame();
//
//	ViewController::preRender();
//		//if ( this->frameIndex <= 50 ) {
//		//	frameLoaded = this->loadFrame();
//		//}
//		//else if ( this->frameIndex > 50 ) {
//		//static int i = 0;
//		//if ( i < 10 ) {
//		//	this->simulation->getMesh(1)->addNodeExternalForce(0, Eigen::Vector3d(3.0f, 7.0f, 0.0f));
//			
//		//	i++;
//		//	}
//		//	else this->simulation->getMesh(1)->setNodeExternalForce(0, 0.0f, 0.0f, 0.0f);
//		//	this->simulation->resume();
//		//	this->simulation->update();
//		//}
//		//if ( frameLoaded == false ) {
//		//	this->simulation->resume();
//		//	this->simulation->update();
//		//}
//		if ( this->paused == false ) this->simulation->render();
//	ViewController::postRender();
//}
//
//bool Sx::Simulation::Interface::MSS_ReplayController::setRecording(Recording::MSM_SimulationRecording* recording) {
//	if ( recording == nullptr ) {
//		std::cerr << "[MSS_ReplayController:setRecording] Warning: Cannot provide playback of nullptr recording." << std::endl;
//		std::cerr << "  Recording set to nullptr." << std::endl;
//	}
//
//	this->recording = recording;
//	return true;
//}
//
//void Sx::Simulation::Interface::MSS_ReplayController::pause() {
//	this->paused = true;
//}
//
//void Sx::Simulation::Interface::MSS_ReplayController::resume() {
//	this->paused = false;
//}
//
//void Sx::Simulation::Interface::MSS_ReplayController::play() {
//	this->paused = false;
//}
//
//bool Sx::Simulation::Interface::MSS_ReplayController::isPlaying() const {
//	return !this->paused;
//}
//
//bool Sx::Simulation::Interface::MSS_ReplayController::isPaused() const {
//	return this->paused;
//}
//
//bool Sx::Simulation::Interface::MSS_ReplayController::setStartFrame(unsigned int frameNumber) {
//	if ( this->recording == nullptr ) return false;
//	this->startFrame = frameNumber;
//	return true;
//}
//
//bool Sx::Simulation::Interface::MSS_ReplayController::setEndFrame(unsigned int frameNumber) {
//	if ( this->recording == nullptr ) return false;
//	this->endFrame = frameNumber;
//	return true;
//}
//
//bool Sx::Simulation::Interface::MSS_ReplayController::hasRecording() const {
//	if ( this->recording == nullptr ) return false;
//	return true;
//}
//
//unsigned int Sx::Simulation::Interface::MSS_ReplayController::getFrameCount() const {
//	if ( this->recording == nullptr ) return 0;
//	return this->recording->getFrameCount();
//}
//
//unsigned int Sx::Simulation::Interface::MSS_ReplayController::getNumFrames() const {
//	if ( this->recording == nullptr ) return 0;
//	return this->recording->getNumFrames();
//}
//
///* This function has to be as FAST as possible */
//bool Sx::Simulation::Interface::MSS_ReplayController::loadFrame() const {
//	if ( this->recording == nullptr ) return false;
//
//	//--------------------------------------------------------------------------
//	// Get the current frame based on the viewport controller frame index.
//	// (This index has to be reset each time the animation is played).
//	//--------------------------------------------------------------------------
//	bool success = false;
//	Recording::MSM_SimulationFrame& frame = this->recording->getFrame(this->frameIndex, success);
//	if ( success == false ) return false;
//
//	//--------------------------------------------------------------------------
//	// For each object entry in the simulation, restore the state of its nodes.
//	//--------------------------------------------------------------------------
//	Objects::MassSpringMesh* mesh = nullptr;
//	for ( unsigned int i = 0; i < frame.getEntryCount(); i++ ) {
//		Recording::MSM_RecordingEntry& entry = frame.getEntry(i);
//		mesh = entry.mesh;
//
//		if ( mesh == nullptr ) {
//			std::cerr << "[MSS_ReplayController:loadFrame] Error: Cannot load state of nullptr mass-spring mesh." << std::endl;
//			continue;
//		}
//
//		if ( mesh->getNodeCount() != entry.getNodeStateCount() ) {
//			std::cerr << "[MSS_ReplayController:loadFrame] Error: Mass-spring mesh node count does not match recorded entry." << std::endl;
//			continue;
//		}
//
//		//----------------------------------------------------------------------
//		// Restore the state of the mass-spring mesh to that defined in the
//		// recorded entry.
//		//----------------------------------------------------------------------
//		for ( unsigned int x = 0; x < mesh->getNodeCount(); x++ ) {
//			States::NodeState& state = entry.states[x];
//
//			mesh->setNodePosition(x, state.px, state.py, state.pz);
//			mesh->setNodeVelocity(x, state.vx, state.vy, state.vz);
//			mesh->setNodeAcceleration(x, state.ax, state.ay, state.az);
//			mesh->setNodeExternalForce(x, state.fx, state.fy, state.fz);
//		}
//	}
//
//	return true;
//}
